import requests
import re
cookies = {
    '_lxsdk_cuid': '181058e6acac8-06b8ff0ce60554-3a67410c-e1000-181058e6acac8',
    'uuid_n_v': 'v1',
    'uuid': '9A968190A09911EFBA2BF1D880B1E02E561F5D02DA69412D84D92A65973D64B4',
    '_csrf': '0b80649c102a889de79eaee64f86d86a0c47ee670fd7140915a6529b45a266ad',
    '_lx_utm': 'utm_source%3Dbing%26utm_medium%3Dorganic',
    '_lxsdk': '9A968190A09911EFBA2BF1D880B1E02E561F5D02DA69412D84D92A65973D64B4',
    '_ga': 'GA1.1.1259769412.1731376661',
    '_ga_WN80P4PSY7': 'GS1.1.1731401095.2.1.1731401133.0.0.0',
    '__mta': '50109081.1731376661522.1731401100401.1731401134285.6',
    '_lxsdk_s': '193204fd201-a39-abe-a13%7C%7C1',
}

headers = {
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
    'Cache-Control': 'no-cache',
    'Connection': 'keep-alive',
    # 'Cookie': '_lxsdk_cuid=181058e6acac8-06b8ff0ce60554-3a67410c-e1000-181058e6acac8; uuid_n_v=v1; uuid=9A968190A09911EFBA2BF1D880B1E02E561F5D02DA69412D84D92A65973D64B4; _csrf=0b80649c102a889de79eaee64f86d86a0c47ee670fd7140915a6529b45a266ad; _lx_utm=utm_source%3Dbing%26utm_medium%3Dorganic; _lxsdk=9A968190A09911EFBA2BF1D880B1E02E561F5D02DA69412D84D92A65973D64B4; _ga=GA1.1.1259769412.1731376661; _ga_WN80P4PSY7=GS1.1.1731401095.2.1.1731401133.0.0.0; __mta=50109081.1731376661522.1731401100401.1731401134285.6; _lxsdk_s=193204fd201-a39-abe-a13%7C%7C1',
    'Pragma': 'no-cache',
    'Referer': 'https://www.maoyan.com/films?showType=2&offset=0',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-User': '?1',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0',
    'sec-ch-ua': '"Chromium";v="130", "Microsoft Edge";v="130", "Not?A_Brand";v="99"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
}

params = {
    'showType': '2',
    'offset': '60',#一页30个
}

response = requests.get('https://www.maoyan.com/films', params=params, cookies=cookies, headers=headers)

# 提取文档中的woff字体文件
pattern = r'//[^\s]+\.woff'
woff_urls = re.findall(pattern, response.text)
woff_url = ''
for url in woff_urls:
    woff_url = url
woff_url = 'https:' + woff_url
print("woff::url", woff_url)
# 发送 GET 请求
response = requests.get(woff_url)
# 检查请求是否成功
if response.status_code == 200:
    # 保存文件
    with open('11-12.woff', 'wb') as file:
        file.write(response.content)
    print("woff文件下载成功")
else:
    print(f"请求失败，状态码: {response.status_code}")

